﻿using CXJY_Preview.Base;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CXJY_Preview.Controls;
using CXJY_Preview.Models;

namespace CXJY_Preview.ViewModels
{
    public class MainViewModel:NoityBase
    {
        private object _pageContent;

        public object PageContent
        {
            get { return _pageContent; }
            set { SetProperty(ref  _pageContent,value); }
        }

        private string _Total;

        public string Total
        {
            get { return _Total; }
            set{SetProperty(ref  _Total,value);}
        }

        private string _productionCount;

        public string ProductionCount
        {
            get { return _productionCount; }
            set { SetProperty(ref _productionCount, value); }
        }


        private string _badCount;

        public string BadCount
        {
            get { return _badCount; }
            set { SetProperty(ref _badCount, value); }
        }

        public List<MonitorItemModel> Evironmret { get; set; }

        public List<MonitorItemModel> DeviceMonitor { get; set; }

        public List<AlarmItemModel> AlarmList { get; set; }

        public ObservableCollection<RaderSeriesModel> RaderDatas { get; set; }
        
        public List<PersonnelItemModel> PersonnelList { get; set; }
        public List<WorkShopItemModel> WorkshopList { get; set; }

        public MainViewModel()
        {
            Total = 197.ToString("0000");
            ProductionCount = 7147.ToString("00000");
            BadCount = 17.ToString("000");

            #region 初始化环境监控
            Evironmret = new List<MonitorItemModel>();
            Evironmret.Add(new MonitorItemModel() { Hread = "光照(Lux)" });
            Evironmret.Add(new MonitorItemModel() { Hread = "噪音(db)" });
            Evironmret.Add(new MonitorItemModel() { Hread = "温度(℃)" });
            Evironmret.Add(new MonitorItemModel() { Hread = "湿度(%)" });
            Evironmret.Add(new MonitorItemModel() { Hread = "PM2.5(m³)" });
            Evironmret.Add(new MonitorItemModel() { Hread = "硫化氢(ppm)" });
            Evironmret.Add(new MonitorItemModel() { Hread = "氦气(ppm)" });
            #endregion

            #region 初始化消息列表
            AlarmList = new List<AlarmItemModel>();
            AlarmList.Add(new AlarmItemModel { Num = "01", Message = "设备温度过高", Time = "2022-07-05 20:00:00", len = 5 });
            AlarmList.Add(new AlarmItemModel { Num = "02", Message = "车间温度过高", Time = "2022-07-05 20:00:00", len = 5 });
            AlarmList.Add(new AlarmItemModel { Num = "03", Message = "设备转速过高", Time = "2022-07-05 20:00:00", len = 5 });
            #endregion

            #region 初始化设备监控
            DeviceMonitor = new List<MonitorItemModel>();
            DeviceMonitor.Add(new MonitorItemModel { Hread = "电能(Kw.h)", Value = 311.2 });
            DeviceMonitor.Add(new MonitorItemModel { Hread = "电压(V)", Value = 311.2 });
            DeviceMonitor.Add(new MonitorItemModel { Hread = "电流(A)", Value = 311.2 });
            DeviceMonitor.Add(new MonitorItemModel { Hread = "压差(kpa)", Value = 311.2 });
            DeviceMonitor.Add(new MonitorItemModel { Hread = "温度(℃)", Value = 311.2 });
            DeviceMonitor.Add(new MonitorItemModel { Hread = "振动(mm/s)", Value = 311.2 });
            DeviceMonitor.Add(new MonitorItemModel { Hread = "转速(r/min)", Value = 311.2 });
            DeviceMonitor.Add(new MonitorItemModel { Hread = "气压(kpa)", Value = 311.2 });
            #endregion

            #region 初始化雷达数据
            RaderDatas = new ObservableCollection<RaderSeriesModel>();
            Random random = new Random();
            for (int i = 1; i <= 7; i++)
            {
                RaderDatas.Add(new RaderSeriesModel { Header = "Tag" + i, Value = random.Next(20, 100) });
            }
            #endregion

            #region 初始化人员缺岗信息
            PersonnelList = new List<PersonnelItemModel>();
            PersonnelList.Add(new PersonnelItemModel { Name = "张三", Duties = "技术员", MathHour = 123 });
            PersonnelList.Add(new PersonnelItemModel { Name = "张三", Duties = "操作员", MathHour = 123 });
            PersonnelList.Add(new PersonnelItemModel { Name = "张三", Duties = "技术员", MathHour = 123 });
            PersonnelList.Add(new PersonnelItemModel { Name = "张三", Duties = "技术员", MathHour = 123 });
            PersonnelList.Add(new PersonnelItemModel { Name = "张三", Duties = "技术员", MathHour = 123 });
            #endregion

            #region 初始化车间列表
            WorkshopList = new List<WorkShopItemModel>();
            WorkshopList.Add(new WorkShopItemModel { Name = "贴片车间", TotalCount = 35, WorkCount = 32, WaitCount = 8, FautCount = 4, StopCount = 0 });
            WorkshopList.Add(new WorkShopItemModel { Name = "封装车间", TotalCount = 45, WorkCount = 32, WaitCount = 8, FautCount = 4, StopCount = 0 });
            WorkshopList.Add(new WorkShopItemModel { Name = "焊接车间", TotalCount = 15, WorkCount = 32, WaitCount = 8, FautCount = 4, StopCount = 0 });
            WorkshopList.Add(new WorkShopItemModel { Name = "灌胶车间", TotalCount = 25, WorkCount = 32, WaitCount = 8, FautCount = 4, StopCount = 0 });
            WorkshopList.Add(new WorkShopItemModel { Name = "点胶车间", TotalCount = 65, WorkCount = 32, WaitCount = 8, FautCount = 4, StopCount = 0 });
            #endregion
        }
    }
}
